﻿/*******************************************************************************
 * AAEngine
 * Copyright (c) 2010 Mike Jarosch
 *
 * This file is licensed under the terms of the MIT license, which is included
 * in the "MIT License.txt" file at the root directory of this SDK.
 ******************************************************************************/

using Microsoft.Xna.Framework;
using AAEngine.Engine.Entities;

namespace AAEngine.Rendering2D
{
    public class Camera2D : EntityComponent, ICamera2D
    {
        public float Zoom { get; set; }
        public float Rotation { get; set; }
        public Vector2 Position { get; set; }

        public Matrix TransformationMatrix
        {
            get
            {
                return Matrix.CreateTranslation(
                    new Vector3(-Position.X, -Position.Y, 0)) *
                    Matrix.CreateRotationZ(MathHelper.ToRadians(Rotation)) *
                    Matrix.CreateScale(new Vector3(Zoom, Zoom, 0));
            }
        }

        public Camera2D()
        {
            Zoom = 1;
        }
    }
}
